package com.collection.vectors;

import java.util.Collections;
import java.util.Vector;

public class SortJavaVectorExample {
	public static void main(String[] args) {
		   
	    //create Vector object
	    Vector v = new Vector();
	   
	    //Add elements to Vector
	    v.add("1");
	    v.add("3");
	    v.add("5");
	    v.add("2");
	    v.add("4");
	 
	    /*
	      To sort a Vector object, use Collection.sort method. This is a
	      static method. It sorts an Vector object's elements into ascending order.
	    */
	    Collections.sort(v);
	   
	    //display elements of Vector
	    System.out.println("Vector elements after sorting in ascending order : ");
	    for(int i=0; i<v.size(); i++)
	      System.out.println(v.get(i));
	 
	  }
}
